import React from 'react';
import * as THREE from 'three';
import Scene from '../Scene';
import vertexShader from './shaders/uvTest/vertex.glsl';
import fragmentShader from './shaders/uvTest/fragment.glsl';
import style from '../FrozenStation.css';

export default class UVTest {
    constructor(){
        this.scene = new Scene();
        this.canvasScene = this.scene.scene;
        this.resources = this.scene.resources;
        this.model = this.resources.items.tube;
        this.renderer = this.scene.renderer;
        this.time = this.scene.time;
        this.sizes = this.scene.sizes;
        this.time = this.scene.time;
        this.camera = this.scene.camera.perspectiveCamera;
        this.setModel();
    }
    setModel(){
        let that = this;
        let texture = new THREE.TextureLoader().load('/models/test.png');
        let texture2 = new THREE.TextureLoader().load('/models/bake.jpg');

        texture.wrapS = THREE.RepeatWrapping;
        texture.wrapT = THREE.RepeatWrapping;
        let planeGeometry = new THREE.PlaneGeometry(5, 5);
        let planeMtl = new THREE.ShaderMaterial({
            vertexShader,
            fragmentShader,
            uniforms:{
                tex:{
                    value:texture
                },
                tex2:{
                    value:texture2
                },
                
            }
        })
        let mesh = new THREE.Mesh(planeGeometry, planeMtl);
        this.canvasScene.add(mesh); 
        console.log(mesh);
        console.log(texture);
        console.log(planeGeometry.attributes.uv.array[0]);          
        setTimeout(()=>{
            // console.log(planeGeometry.attributes.uv.array[0]);     
            
        },3000)
        
    }
}